package com.ilomed.repository;

import java.util.List;

import javax.persistence.Query;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.ilomed.model.Goal;

@Repository("goalRepository")
public class GoalRepositoryImpl extends GlobalRepository<Goal> implements GoalRepository {
	
	public GoalRepositoryImpl() {
		super(Goal.class);
	}

	@SuppressWarnings("unchecked")
	@Transactional(readOnly = true)
	public List<Goal> loadAll() {
		Query query = em.createQuery("Select g from Goal g");
//		Query query = em.createNamedQuery("Goal.findAll");
		
		List<Goal> goals = query.getResultList();
		
		return goals;
	}

}
